package lc.oa.ui;


import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import lc.oa.R;


/**
 * Created by maxcion_home on 2017/10/30.
 */

public class NHeadView extends LinearLayout {

  //  public SearchView searchView;

    //private OnScanAndVoiceListener listener;
    public ImageView scanImg;

    public NHeadView(Context context) {
        this(context, null);
    }

    public NHeadView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public NHeadView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        LayoutInflater.from(context).inflate(R.layout.nhead_layout, this);
//        searchView = (SearchView) findViewById(R.id.search);
//        scanImg = (ImageView) findViewById(R.id.scan_iv);
//        ImageView message = (ImageView) findViewById(R.id.message_iv);
//        scanImg.setOnClickListener(this);
//        message.setOnClickListener(this);
//        if (this.getId()==R.id.nheadview_top){
//            TextView textView=findViewById(R.id.txtTitle);
//            textView.setText("乐卡OA");
//            ((TextView) findViewById(R.id.tvMore)).setText("");
//        }
        if (this.getId()==R.id.nheadview_todo){
            TextView textView=findViewById(R.id.txtTitle);
            textView.setText("待办事项(4)");
        }
        if (this.getId()==R.id.nheadview_message){
            TextView textView=findViewById(R.id.txtTitle);
            textView.setText("消息");
        }
//        if (this.getId()==R.id.nheadview_my){
//            TextView textView=findViewById(R.id.txtTitle);
//            textView.setText("我的");
//            ((TextView) findViewById(R.id.tvMore)).setText("");
//        }
        if (this.getId()==R.id.nheadview_achievement){
            TextView textView=findViewById(R.id.txtTitle);
            textView.setText("业绩");
            ((TextView) findViewById(R.id.tvMore)).setText("");
        }
//        if (this.getId()==R.id.nheadview_calendar){
//            TextView textView=findViewById(R.id.txtTitle);
//            textView.setText("日历");
//            ((TextView) findViewById(R.id.tvMore)).setText("");
//        }
    }

//    public void setOnQueryTextListener(SearchView.OnQueryTextListener listener) {
//        searchView.setOnQueryTextListener(listener);
//    }
//
//    public void setOnScanAndSpeakListener(OnScanAndVoiceListener listener) {
//        this.listener = listener;
//    }

//    @Override
//    public void onClick(View v) {
//        switch (v.getId()) {
//            case R.id.scan_iv:
//                listener.startScanner();
//                break;
//            case R.id.message_iv:
//                listener.startSpeak();
//                break;
//        }
//    }
}
